//获取应用实例
const app = getApp();

Page({
	data: {
    recordList:[],
  },
	onLoad: function() {
    this.getRecord();
  },


  //获取用户余额变动记录
  getRecord: function () {
    var that = this;
    wx.request({
      url: app.globalData.api + '/app.php?c=UserBalanceRecord&a=getBalanceRecord2',
      data: {
        token: app.globalData.token,//手机号码
        type: 1,
        page: 1,
        per: 100
      },
      header: {
        "Content-Type": "application/x-www-form-urlencoded",
        'platform': '' + app.globalData.platform,
        'version': '' + app.globalData.version,
      },
      method: 'POST',
      dataType: 'json',
      success(res) {
        console.log(res)
        if (res.data.code == 0) {
          that.setData({
            recordList: res.data.data.list
          })
        } else {
          wx.showToast({
            title: '' + res.data.msg,//提示文字
            duration: 2000,//显示时长
            mask: true,//是否显示透明蒙层，防止触摸穿透，默认：false  
            icon: 'none', //图标，支持"success"、"loading"  
            success: function () { },//接口调用成功
            fail: function () { },  //接口调用失败的回调函数  
            complete: function () { } //接口调用结束的回调函数  
          })
        }

      }
    })
  },
});
